home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWViews / Sources / FWCntrHW.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  22.1 KB  |  659 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCntrHW.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifdef FW_BUILD_WIN
  11.  
  12. #include "FWFrameW.hpp"
  13.  
  14. #ifndef FWHIDNFR_H
  15. #include "FWCntrHW.h"
  16. #endif
  17.  
  18. #ifndef FWSCLBAR_H
  19. #include "FWSclBar.h"
  20. #endif
  21.  
  22. #ifndef FWCLUSTR_H
  23. #include "FWClustr.h"
  24. #endif
  25.  
  26. #ifndef FWFRAME_H
  27. #include "FWFrame.h"
  28. #endif
  29.  
  30. // ----- OS Includes -----
  31.  
  32. #ifndef FWPOINT_H
  33. #include "FWPoint.h"
  34. #endif
  35.  
  36. #ifndef FWCFMRES_H
  37. #include "FWCFMRes.h"
  38. #endif
  39.  
  40. //========================================================================================
  41. // Runtime Information
  42. //========================================================================================
  43.  
  44. #ifdef FW_BUILD_MAC
  45. #pragma segment fwviews
  46. #endif
  47.  
  48. //========================================================================================
  49. // Global declarations
  50. //========================================================================================
  51.  
  52. WORD WM_ODFGETOBJECT = ::RegisterWindowMessage("Apple:Framework:GetObject");
  53.  
  54. //========================================================================================
  55. // CLASS FW_CPrivWinControlHelper
  56. //========================================================================================
  57.  
  58. FW_DEFINE_CLASS_M0(FW_CPrivWinControlHelper)
  59.  
  60. //----------------------------------------------------------------------------------------
  61. // FW_CPrivWinControlHelper::FW_CPrivWinControlHelper
  62. //----------------------------------------------------------------------------------------
  63.  
  64. FW_CPrivWinControlHelper::FW_CPrivWinControlHelper(Environment* ev,
  65.                                                     const FW_CClassInfo& classInfo,
  66.                                                    FW_CControl* control) :
  67.     fControl(control),
  68.     fHWnd(NULL)
  69. {
  70.     CheckForInitialize(ev, classInfo);
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper
  75. //----------------------------------------------------------------------------------------
  76.  
  77. FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper()
  78. {
  79.     ::DestroyWindow(fHWnd);
  80. }
  81.  
  82. //----------------------------------------------------------------------------------------
  83. // FW_CPrivWinControlHelper::CheckForInitialize
  84. //----------------------------------------------------------------------------------------
  85.  
  86. void FW_CPrivWinControlHelper::CheckForInitialize(Environment* ev, const FW_CClassInfo& classInfo)
  87. {
  88.     if (classInfo == FW_TYPEID_FROM_POINTER(this))
  89.         this->Initialize(ev);
  90. }
  91.  
  92. //----------------------------------------------------------------------------------------
  93. // FW_CPrivWinControlHelper::Initialize
  94. //----------------------------------------------------------------------------------------
  95.  
  96. void FW_CPrivWinControlHelper::Initialize(Environment* ev)
  97. {
  98.     RegisterSuperClass(GetSuperClassInfo());
  99.     
  100.     FW_CPlatformPoint wndLocation    = fControl->GetLocation(ev).AsPlatformPoint();
  101.     FW_CPlatformPoint wndSize        = fControl->GetSize(ev).AsPlatformPoint();
  102.     
  103.     fHWnd = CreateHWnd(fControl->GetFrame(ev)->GetShadowWindow(ev), wndLocation, wndSize);
  104. }
  105.  
  106. //----------------------------------------------------------------------------------------
  107. // FW_CPrivWinControlHelper::RegisterSuperClass
  108. //----------------------------------------------------------------------------------------
  109.  
  110. FW_Boolean FW_CPrivWinControlHelper::RegisterSuperClass
  111.         (FW_SPrivWinSuperClassInfo& superClassInfo)
  112. {
  113.     
  114.     FW_Boolean success = FALSE;
  115.     WNDCLASS wc;
  116.     
  117.     if (::GetClassInfo(NULL, superClassInfo.fClassName, &wc))
  118.         success = TRUE;
  119.     else if (::GetClassInfo(NULL, superClassInfo.fOldClassName, &wc))
  120.     {
  121.         superClassInfo.fOldWndProc = wc.lpfnWndProc;
  122.         superClassInfo.fWndExtraBytes = wc.cbWndExtra;
  123.  
  124.         wc.hInstance = FW_gInstance;
  125.         wc.lpszClassName = superClassInfo.fClassName;
  126.         wc.lpfnWndProc = superClassInfo.fWndProc;
  127.         wc.cbWndExtra = superClassInfo.fWndExtraBytes + sizeof(void *);
  128.         wc.style |= CS_GLOBALCLASS;
  129.  
  130.         success = ::RegisterClass(&wc);
  131.     }
  132.     
  133.     if (!success)
  134.         FW_DEBUG_MESSAGE("Unable to register Windows class!");
  135.         
  136.     return success;
  137. }
  138.  
  139. //----------------------------------------------------------------------------------------
  140. // FW_CPrivWinControlHelper::Move
  141. //----------------------------------------------------------------------------------------
  142.  
  143. void FW_CPrivWinControlHelper::Move(const FW_CPlatformPoint& location,
  144.                                      const FW_CPlatformPoint& size)
  145. {
  146.     ::MoveWindow(fHWnd, location.x, location.y, size.x, size.y, TRUE);
  147. }
  148.  
  149. //----------------------------------------------------------------------------------------
  150. // FW_CPrivWinControlHelper::SetText
  151. //----------------------------------------------------------------------------------------
  152.  
  153. void FW_CPrivWinControlHelper::SetText(const FW_CString& text)
  154. {
  155.     ::SetWindowText(fHWnd, text);
  156. }
  157.  
  158. //----------------------------------------------------------------------------------------
  159. // FW_CPrivWinControlHelper::GetText
  160. //----------------------------------------------------------------------------------------
  161.  
  162. void FW_CPrivWinControlHelper::GetText(FW_CString& text) const
  163. {
  164.     int len = ::GetWindowTextLength(fHWnd);
  165.     char *windowText = new char[len + 1];
  166.     ::GetWindowText(fHWnd, windowText, len);
  167.     
  168.     text.ReplaceAll(windowText);
  169.     delete [] windowText;
  170. }
  171.  
  172. //----------------------------------------------------------------------------------------
  173. // FW_CPrivWinControlHelper::HWNDToHelper
  174. //----------------------------------------------------------------------------------------
  175.  
  176. FW_CPrivWinControlHelper* FW_CPrivWinControlHelper::HWNDToHelper(HWND hWnd)
  177. {
  178.     return (FW_CPrivWinControlHelper *) ::SendMessage(hWnd, WM_ODFGETOBJECT, 0, 0);
  179. }
  180.  
  181. //========================================================================================
  182. // CLASS FW_CPrivWinScrollBarHelper
  183. //========================================================================================
  184.  
  185. FW_SPrivWinSuperClassInfo FW_CPrivWinScrollBarHelper::fSuperClassInfo =
  186. {
  187.     "FW_SCROLLBAR", "SCROLLBAR", FW_CPrivWinScrollBarHelper::WindowProc, NULL, 0
  188. };
  189.  
  190. FW_DEFINE_CLASS_M1(FW_CPrivWinScrollBarHelper, FW_CPrivWinControlHelper)
  191.  
  192. //----------------------------------------------------------------------------------------
  193. // FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper
  194. //----------------------------------------------------------------------------------------
  195.  
  196. FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper(Environment* ev,
  197.                                                         const FW_CClassInfo& classInfo,
  198.                                                        FW_CScrollBar* scrollBar) :
  199.     FW_CPrivWinControlHelper(ev, classInfo, scrollBar)
  200. {
  201.     CheckForInitialize(ev, classInfo);
  202. }
  203.  
  204. //----------------------------------------------------------------------------------------
  205. // FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper
  206. //----------------------------------------------------------------------------------------
  207.  
  208. FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper()
  209. {
  210. }
  211.  
  212. //----------------------------------------------------------------------------------------
  213. // FW_CPrivWinScrollBarHelper::Initialize
  214. //----------------------------------------------------------------------------------------
  215.  
  216. void FW_CPrivWinScrollBarHelper::Initialize(Environment* ev)
  217. {
  218.     FW_CPrivWinControlHelper::Initialize(ev);
  219.     
  220.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetControl());
  221.     FW_ASSERT(scrollBar);
  222.     
  223.     SetScrollRange(FW_CScrollBar::kDefaultScrollMin, FW_CScrollBar::kDefaultScrollMax);
  224.     SetScrollPos(FW_CScrollBar::kDefaultScrollPos);
  225. }
  226.  
  227. //----------------------------------------------------------------------------------------
  228. // FW_CPrivWinScrollBarHelper::CreateHWnd
  229. //----------------------------------------------------------------------------------------
  230.  
  231. HWND FW_CPrivWinScrollBarHelper::CreateHWnd(HWND parent,
  232.                                             const FW_CPlatformPoint& location,
  233.                                             const FW_CPlatformPoint& size)
  234. {
  235.     DWORD orientation = size.x > size.y ? SBS_HORZ : SBS_VERT;
  236.     
  237. #ifdef FW_BUILD_WIN16
  238.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  239.                            location.x, location.y,
  240.                            size.x, size.y,
  241.                            parent, 100,
  242.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  243.                            this);
  244. #endif
  245.  
  246. #ifdef FW_BUILD_WIN32
  247.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  248.                            location.x, location.y,
  249.                            size.x, size.y,
  250.                            parent, 
  251.                            (HMENU)100,
  252.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  253.                            this);
  254. #endif
  255. }
  256.  
  257. //----------------------------------------------------------------------------------------
  258. // FW_CPrivWinScrollBarHelper::HandleScrollMessage
  259. //----------------------------------------------------------------------------------------
  260.  
  261. void FW_CPrivWinScrollBarHelper::HandleScrollMessage(WORD sbCode, WORD currentPosition)
  262. {
  263.     Environment* ev = somGetGlobalEnvironment();
  264.     
  265.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetControl());
  266.     FW_ASSERT(scrollBar);
  267.     
  268.     FW_Fixed changeBy = ff(0);
  269.  
  270.     switch (sbCode)
  271.     {
  272.         case SB_BOTTOM:
  273.             changeBy = scrollBar->GetScrollMax(ev) - ff(GetScrollPos());
  274.             break;
  275.         case SB_TOP:
  276.             changeBy = scrollBar->GetScrollMin(ev) - ff(GetScrollPos());
  277.             break;
  278.         case SB_LINEDOWN:
  279.             changeBy = scrollBar->GetMinorScrollUnits(ev);
  280.             break;
  281.         case SB_LINEUP:
  282.             changeBy = -scrollBar->GetMinorScrollUnits(ev);
  283.             break;
  284.         case SB_PAGEDOWN:
  285.             changeBy = scrollBar->GetMajorScrollUnits(ev);
  286.             break;
  287.         case SB_PAGEUP:
  288.             changeBy = -scrollBar->GetMajorScrollUnits(ev);
  289.             break;
  290.         case SB_THUMBPOSITION:
  291.             changeBy = ff(currentPosition - GetScrollPos());
  292.             break;
  293.     };
  294.     
  295.     FW_Fixed oldValue = ff(GetScrollPos()) - scrollBar->GetScrollMin(ev);
  296.     FW_Fixed newValue = oldValue + changeBy;
  297.     
  298.     if (newValue < scrollBar->GetScrollMin(ev))
  299.         newValue = scrollBar->GetScrollMin(ev);
  300.     else if (newValue > scrollBar->GetScrollMax(ev))
  301.         newValue = scrollBar->GetScrollMax(ev);
  302.     
  303.     newValue += scrollBar->GetScrollMin(ev);
  304.     
  305.     SetScrollPos(FixedToInt(newValue));
  306.     
  307.     scrollBar->ScrollPositionChanged(ev, newValue, newValue - oldValue);
  308. }
  309.  
  310. //----------------------------------------------------------------------------------------
  311. // FW_CPrivWinScrollBarHelper::GetSuperClassInfo
  312. //----------------------------------------------------------------------------------------
  313.  
  314. FW_SPrivWinSuperClassInfo& FW_CPrivWinScrollBarHelper::GetSuperClassInfo() const
  315. {
  316.     return fSuperClassInfo;
  317. }
  318.  
  319. //----------------------------------------------------------------------------------------
  320. // FW_CPrivWinScrollBarHelper::WindowProc
  321. //----------------------------------------------------------------------------------------
  322.  
  323. LRESULT CALLBACK FW_CPrivWinScrollBarHelper::WindowProc(HWND hWnd, UINT msg,
  324.                                                         WPARAM wParam, LPARAM lParam)
  325. {
  326.     switch (msg)
  327.     {
  328.         case WM_CREATE:
  329.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  330.                               hWnd, msg, wParam, lParam);
  331.             
  332.             // The FW_CPrivWinScrollBarHelper object is passed in to CreateWindow. Pull it
  333.             // out and stuff it in Window extra bytes.
  334.             
  335.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  336.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  337.             return 0L;
  338.             
  339.         case WM_PAINT:
  340.             break;
  341.             
  342.         case WM_DESTROY:
  343.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  344.             break;
  345.         
  346.         default:
  347.             // Get the Window extra bytes, which is the FW_CPrivWinScrollBarHelper object
  348.             // for this window, and return it.
  349.             
  350.             if (msg == WM_ODFGETOBJECT)
  351.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  352.     }
  353.  
  354.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  355.                              hWnd, msg, wParam, lParam);    
  356. }
  357.  
  358. //========================================================================================
  359. // CLASS FW_CPrivWinButtonHelper
  360. //========================================================================================
  361.  
  362. FW_SPrivWinSuperClassInfo FW_CPrivWinButtonHelper::fSuperClassInfo =
  363. {
  364.     "FW_BUTTON", "BUTTON", FW_CPrivWinButtonHelper::WindowProc, NULL, 0
  365. };
  366.  
  367. FW_DEFINE_CLASS_M1(FW_CPrivWinButtonHelper, FW_CPrivWinControlHelper)
  368.  
  369. //----------------------------------------------------------------------------------------
  370. // FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper
  371. //----------------------------------------------------------------------------------------
  372.  
  373. FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper(Environment* ev,
  374.                                                 const FW_CClassInfo& classInfo,
  375.                                                  FW_CButton* button) :
  376.     FW_CPrivWinControlHelper(ev, classInfo, button)
  377. {
  378.     CheckForInitialize(ev, classInfo);
  379. }
  380.  
  381. //----------------------------------------------------------------------------------------
  382. // FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper
  383. //----------------------------------------------------------------------------------------
  384.  
  385. FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper()
  386. {
  387. }
  388.  
  389. //----------------------------------------------------------------------------------------
  390. // FW_CPrivWinButtonHelper::GetSuperClassInfo
  391. //----------------------------------------------------------------------------------------
  392.  
  393. FW_SPrivWinSuperClassInfo& FW_CPrivWinButtonHelper::GetSuperClassInfo() const
  394. {
  395.     return fSuperClassInfo;
  396. }
  397.  
  398. //----------------------------------------------------------------------------------------
  399. // FW_CPrivWinButtonHelper::WindowProc
  400. //----------------------------------------------------------------------------------------
  401.  
  402. LRESULT CALLBACK FW_CPrivWinButtonHelper::WindowProc(HWND hWnd, UINT msg,
  403.                                                      WPARAM wParam, LPARAM lParam)
  404. {
  405.     switch (msg)
  406.     {
  407.         case WM_CREATE:
  408.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  409.                               hWnd, msg, wParam, lParam);
  410.             
  411.             // The FW_CPrivWinPushButtonHelper object is passed in to CreateWindow. Pull it
  412.             // out and stuff it in Window extra bytes.
  413.             
  414.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  415.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  416.             return 0L;
  417.             
  418.         case WM_PAINT:
  419.             break;
  420.             
  421.         case WM_DESTROY:
  422.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  423.             break;
  424.         
  425.         default:
  426.             // Get the Window extra bytes, which is the FW_CPrivWinPushButtonHelper object
  427.             // for this window, and return it.
  428.             
  429.             if (msg == WM_ODFGETOBJECT)
  430.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  431.     }
  432.  
  433.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  434.                              hWnd, msg, wParam, lParam);    
  435. }
  436.  
  437. //========================================================================================
  438. // CLASS FW_CPrivWinPushButtonHelper
  439. //========================================================================================
  440.  
  441. FW_DEFINE_CLASS_M1(FW_CPrivWinPushButtonHelper, FW_CPrivWinButtonHelper)
  442.  
  443. //----------------------------------------------------------------------------------------
  444. // FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper
  445. //----------------------------------------------------------------------------------------
  446.  
  447. FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper(Environment* ev,
  448.                                                          const FW_CClassInfo& classInfo,
  449.                                                          FW_CPushButton* button) :
  450.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  451. {
  452.     CheckForInitialize(ev, classInfo);
  453. }
  454.  
  455. //----------------------------------------------------------------------------------------
  456. // FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper
  457. //----------------------------------------------------------------------------------------
  458.  
  459. FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper()
  460. {
  461. }
  462.  
  463. //----------------------------------------------------------------------------------------
  464. // FW_CPrivWinPushButtonHelper::CreateHWnd
  465. //----------------------------------------------------------------------------------------
  466.  
  467. HWND FW_CPrivWinPushButtonHelper::CreateHWnd(HWND parent,
  468.                                              const FW_CPlatformPoint& location,
  469.                                              const FW_CPlatformPoint& size)
  470. {
  471. #ifdef FW_BUILD_WIN16
  472.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  473.                            location.x, location.y,
  474.                            size.x, size.y,
  475.                            parent, 100,
  476.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  477.                            this);
  478. #endif 
  479.  
  480. #ifdef FW_BUILD_WIN32
  481.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  482.                            location.x, location.y,
  483.                            size.x, size.y,
  484.                            parent, 
  485.                            (HMENU)100,
  486.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  487.                            this);
  488. #endif 
  489. }
  490.  
  491. //----------------------------------------------------------------------------------------
  492. // FW_CPrivWinPushButtonHelper::MakeDefaultButton
  493. //----------------------------------------------------------------------------------------
  494.  
  495. void FW_CPrivWinPushButtonHelper::MakeDefaultButton(FW_Boolean isDefault)
  496. {
  497.     unsigned long dwStyle = (unsigned long)(::GetWindowLong(fHWnd, GWL_STYLE));
  498.  
  499.     if (isDefault)                            // Make sure the button's style has BS_DEFPUSHBUTTON
  500.     {
  501.         if ((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON)
  502.             return;
  503.  
  504.         dwStyle |= BS_DEFPUSHBUTTON;
  505.     }
  506.     else                                    // Make sure the button's style doesn't have
  507.         {                                    // BS_DEFPUSHBUTTON
  508.  
  509.             if (!((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON))
  510.                 return;
  511.  
  512.             dwStyle &= ~BS_DEFPUSHBUTTON;
  513.         }
  514.  
  515.     ::SetWindowLong(fHWnd, GWL_STYLE, dwStyle);
  516. }
  517. //----------------------------------------------------------------------------------------
  518. // FW_CPrivWinPushButtonHelper::HandleButtonMessage
  519. //----------------------------------------------------------------------------------------
  520.  
  521. void FW_CPrivWinPushButtonHelper::HandleButtonMessage()
  522. {
  523.     FW_CPushButton* button = FW_DYNAMIC_CAST(FW_CPushButton, GetControl());
  524.     FW_ASSERT(button);
  525.     
  526.     button->ButtonPressed(somGetGlobalEnvironment());
  527. }
  528.  
  529. //========================================================================================
  530. // CLASS FW_CPrivWinRadioButtonHelper
  531. //========================================================================================
  532.  
  533. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioButtonHelper, FW_CPrivWinButtonHelper)
  534.  
  535. //----------------------------------------------------------------------------------------
  536. // FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper
  537. //----------------------------------------------------------------------------------------
  538.  
  539. FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper(Environment* ev,
  540.                                                             const FW_CClassInfo& classInfo,
  541.                                                              FW_CRadioButton* button) :
  542.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  543. {
  544.     CheckForInitialize(ev, classInfo);
  545. }
  546.  
  547. //----------------------------------------------------------------------------------------
  548. // FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper
  549. //----------------------------------------------------------------------------------------
  550.  
  551. FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper()
  552. {
  553. }
  554.  
  555. //----------------------------------------------------------------------------------------
  556. // FW_CPrivWinRadioButtonHelper::CreateHWnd
  557. //----------------------------------------------------------------------------------------
  558.  
  559. HWND FW_CPrivWinRadioButtonHelper::CreateHWnd(HWND parent,
  560.                                              const FW_CPlatformPoint& location,
  561.                                              const FW_CPlatformPoint& size)
  562. {
  563. #ifdef FW_BUILD_WIN16
  564.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  565.                            location.x, location.y,
  566.                            size.x, size.y,
  567.                            parent, 100,
  568.                            ::GetWindowWord(parent, GWW_HINSTANCE), 
  569.                            this);
  570. #endif
  571. #ifdef FW_BUILD_WIN32
  572.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  573.                            location.x, location.y,
  574.                            size.x, size.y,
  575.                            parent, 
  576.                            (HMENU)100,
  577.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  578.                            this);
  579. #endif
  580. }
  581.  
  582. //----------------------------------------------------------------------------------------
  583. // FW_CPrivWinRadioButtonHelper::HandleButtonMessage
  584. //----------------------------------------------------------------------------------------
  585.  
  586. void FW_CPrivWinRadioButtonHelper::HandleButtonMessage()
  587. {
  588.     FW_CRadioButton* button = FW_DYNAMIC_CAST(FW_CRadioButton, GetControl());
  589.     FW_ASSERT(button);
  590.     
  591.     button->ButtonPressed(somGetGlobalEnvironment());
  592. }
  593.  
  594. //========================================================================================
  595. // CLASS FW_CPrivWinRadioClusterHelper
  596. //========================================================================================
  597.  
  598. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioClusterHelper, FW_CPrivWinButtonHelper)
  599.  
  600. //----------------------------------------------------------------------------------------
  601. // FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper
  602. //----------------------------------------------------------------------------------------
  603.  
  604. FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper(Environment* ev,
  605.                                                             const FW_CClassInfo& classInfo,
  606.                                                              FW_CRadioButton* button) :
  607.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  608. {
  609.     CheckForInitialize(ev, classInfo);
  610. }
  611.  
  612. //----------------------------------------------------------------------------------------
  613. // FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper
  614. //----------------------------------------------------------------------------------------
  615.  
  616. FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper()
  617. {
  618. }
  619.  
  620. //----------------------------------------------------------------------------------------
  621. // FW_CPrivWinRadioClusterHelper::CreateHWnd
  622. //----------------------------------------------------------------------------------------
  623.  
  624. HWND FW_CPrivWinRadioClusterHelper::CreateHWnd(HWND parent,
  625.                                              const FW_CPlatformPoint& location,
  626.                                              const FW_CPlatformPoint& size)
  627. {
  628. #ifdef FW_BUILD_WIN16
  629.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  630.                            location.x, location.y,
  631.                            size.x, size.y,
  632.                            parent, 100,
  633.                            ::GetWindowWord(parent, GWW_HINSTANCE), this);
  634. #endif
  635. #ifdef FW_BUILD_WIN32
  636.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  637.                            location.x, location.y,
  638.                            size.x, size.y,
  639.                            parent, 
  640.                            (HMENU)100,
  641.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  642.                            this);
  643. #endif
  644. }
  645.  
  646. //----------------------------------------------------------------------------------------
  647. // FW_CPrivWinRadioClusterHelper::HandleButtonMessage
  648. //----------------------------------------------------------------------------------------
  649.  
  650. void FW_CPrivWinRadioClusterHelper::HandleButtonMessage()
  651. {
  652.     FW_CRadioCluster* button = FW_DYNAMIC_CAST(FW_CRadioCluster, GetControl());
  653.     FW_ASSERT(button);
  654.     
  655. //    button->ButtonPressed();
  656. }
  657.  
  658. #endif
  659.